package jeesample.service.impl;

import java.sql.SQLException;

import jeesample.utils.ExceptionUtils;

import org.apache.log4j.Logger;

public abstract class BaseServiceImpl {
	protected static Logger logger = null;
	
	protected static void dbg(String message) {
		logger.debug(message);
	}
	
	protected static void info(String message) {
		logger.info(message);
	}

	protected static void warn(String message) {
		logger.warn(message);
	}

	protected static String warn(String message, SQLException se) {
		String string=message+":\n"+ExceptionUtils.toString(se);
		logger.warn(message, se);
		return string;
	}
	
	protected static String warn(String message, Throwable th) {
		String string=message+":\n"+ExceptionUtils.toString(th);
		logger.warn(message, th);
		return string;
	}
	
	protected static String err(String message, SQLException se) {
		String string=message+":\n"+ExceptionUtils.toString(se);
		logger.error(message, se);
		return string;
	}
	
	protected static String err(String message, Throwable th) {
		String string=message+":\n"+ExceptionUtils.toString(th);
		logger.error(message, th);
		return string;
	}
	
}
